package com.SuanFa.jiangdongqi.ZuoZiShuDeHe;

public class Solution {
    public int sumOfLeftLeaves(TreeNode root) {
           if (root==null){
               return 0;
           }
           int sum = 0;
           //判断左子树是否为左叶子节点
           if (root.left!=null&&root.left.left==null&&root.left.right==null){
               sum+=root.left.val;
           }
           //判断右子树
           sum+=sumOfLeftLeaves(root.right);
           sum+=sumOfLeftLeaves(root.left);
           return sum;
    }
}
